/*
 * @(#)SimulationClient.java     Robert Denda&Didier Gutacker
 *
 */

/** 
 * Die Klasse SimulationClient stellt die benoetigten Funktionen fuer die Fernsteuerung
 * der Simulationen bereit. 
 *
 *
 * @author 	Robert Denda&Didier Gutacker
 * @version     1.1, 05.09.1997
 * @see SimulationFrame
 * @see Client
 * @see SimClientRIP
 * @see SimClientDVMRP
 *
 */

import java.awt.*;

public abstract class SimulationClient extends Client implements Simulation, Runnable {
 
  public  static TextMethods text;
  public static ThreadGroup tg;

  public SimulationFrame f;

  public Lock textChangeGuard;
  public Image routerImage;

  public SimulationClient( String hostname, int port ) {
    super( hostname, port );
    try {
      routerImage = Toolkit.getDefaultToolkit().getImage( "router.gif" );
      } catch( AWTError e ) { } // try
    tg = clientThread.getThreadGroup();
  }  


  public static void main( String [] argv ) {
  } // SimulationClient.main

  public ThreadGroup getThreadGroup() {
    return tg;
  } // SimulationClient.getThreadGroup

  public void setText( TextMethods text ) {
    textChangeGuard.acquire();
    this.text = text;
    text.frameTitle = text.frameTitle + " <CLIENT>";
    textChangeGuard.release();
    f.repaint();
  } // SimulationClient.setText

  public TextMethods getText() {
    textChangeGuard.acquire();
    TextMethods returnValue = text;
    textChangeGuard.release();
    return returnValue;
  } // SimulationClient.getText

  public Image getRouterImage() {
    return routerImage;
  } // SimulationClient.getRouterImage


} // SimulationClient
